package com.im.test.bean;


import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;

import java.util.List;


/**
 * @date 2021/6/5
 * 内容：
 **/
public class NormalMessageBean {

    private String content;
    private String id;
    private List<ItemsBean> items;

    public String getContent() {
        JSONObject jsonObject = null;
        try {
            jsonObject = JSONObject.parseObject(content);
            String txt = jsonObject.getString("zh");
            return txt==null ? content : txt;
        } catch (Exception e) {
            e.printStackTrace();
            return content;
        }
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public List<ItemsBean> getItems() {
        return items;
    }

    public void setItems(List<ItemsBean> items) {
        this.items = items;
    }

    public static class ItemsBean {
        private String color;
        private String tag;
        private String value;

        public String getColor() {
            return color;
        }

        public void setColor(String color) {
            this.color = color;
        }

        public String getTag() {
            return tag;
        }

        public void setTag(String tag) {
            this.tag = tag;
        }

        public String getValue() {
            if (ObjectUtil.isEmpty(value)){
                return "";
            }
            JSONObject jsonObject = null;
            try {
                jsonObject = JSONObject.parseObject(value);
                String txt = jsonObject.getString("zh");
                return ObjectUtil.isEmpty(txt) ? value : txt;
            } catch (Exception e) {
                e.printStackTrace();
                return value;
            }
//            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }
}
